package com.lambda;


/**
 * lambda表达式
 * @Author zhangqing
 * @Date 2019/6/20 20:21
 **/
public class lambda {
    /**
     * 内部接口
     */
   public interface Apple{
       public int sum(int a,int b );
   }
   public interface Mac{
       public String say(String message);
   }
   //方法
   public static int orange(int a,int b,Apple apple){
       return apple.sum(a, b);
   }
    public static void main(String[] args) {
       //匿名内部类写法
        Apple xigua = new Apple() {
            @Override
            public int sum(int a, int b) {
                return a/b;
            }
        };
        //lombda写法
        Apple apple = (a,b)->a+b;
       Apple lizi = (a,b)->a-b;
        Apple youzi = (a,b)->{return a*b;};
        System.out.println(  orange(1, 2, apple));

        Mac mac = (String a )-> a ;



}}
